<?php
declare(strict_types=1);

namespace LowCode\Naive;

use LowCode\Naive;
use LowCode\Support\JsExp;
use LowCode\Traits\Props\HasBordered;
use LowCode\Traits\Slots\HasSlotFooter;
use LowCode\Traits\Slots\HasSlotHeader;

/**
 * NList组件
 * @method static static make(mixed $children = null) Thing组件
 */
class NList extends Naive
{

    use HasBordered;
    use HasSlotHeader, HasSlotFooter;

    /**
     * @param mixed|null $children
     */
    public function __construct(mixed $children = null)
    {
        parent::__construct("NList");
        $this->children($children);
    }

    /**
     * 设置组件列表项是否有可点击样式
     * @param bool|JsExp $bool
     * @return $this
     */
    public function clickable(bool|JsExp $bool = true): static
    {
        return $this->prop('clickable', $bool);
    }

    /**
     * 列表项是否有悬浮样式
     * @param bool|JsExp $bool
     * @return $this
     */
    public function hoverable(bool|JsExp $bool = true): static
    {
        return $this->prop('hoverable', $bool);
    }

    /**
     * 是否显示标项之间的分割线
     * @param bool|JsExp $bool
     * @return $this
     */
    public function showDivider(bool|JsExp $bool = true): static
    {
        return $this->prop('show-divider', $bool);
    }

    /**
     * @param mixed $children
     * @return $this
     */
    public function item(mixed $children): static
    {
        $item = new NListItem($children);
        $this->children($item);
        return $this;
    }
}
